package org.code.mallspringboot.service.impl;

import org.code.mallspringboot.dto.PmsAttributeDto;
import org.code.mallspringboot.mapper.PmsProductAttributeCategoryMapper;
import org.code.mallspringboot.pojo.PmsProductAttributeCategory;
import org.code.mallspringboot.pojo.PmsProductCategoryAttributeRelation;
import org.code.mallspringboot.service.PmsProductAttributeCategoryService;
import org.code.mallspringboot.vo.AttributeListVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PmsProductAttributeCategoryServiceImpl implements PmsProductAttributeCategoryService {

    @Autowired
    private PmsProductAttributeCategoryMapper pmsProductAttributeCategoryMapper;

    @Override
    public List<PmsProductAttributeCategory> selectAll() {
        return pmsProductAttributeCategoryMapper.selectAll();
    }

    @Override
    public List<PmsProductCategoryAttributeRelation> selectByproductCategoryId(int productCategoryId) {
        return pmsProductAttributeCategoryMapper.selectByproductCategoryId(productCategoryId);
    }

    @Override
    public List<PmsProductAttributeCategory> selectPage(int pageNum, int pageSize) {
        return pmsProductAttributeCategoryMapper.selectPage((pageNum - 1) * pageSize, pageSize);
    }

    @Override
    public int total() {
        return pmsProductAttributeCategoryMapper.total();
    }

    @Override
    public int add(String name) {
        return pmsProductAttributeCategoryMapper.add(name);
    }

    @Override
    public int delete(int id) {
        return pmsProductAttributeCategoryMapper.delete(id);
    }

    @Override
    public int update(int id, String name) {
        return pmsProductAttributeCategoryMapper.update(id, name);
    }

    @Override
    public List<AttributeListVo> selectAttributePage(int id,int type, int pageNum, int pageSize) {
        return pmsProductAttributeCategoryMapper.selectAttributePage(id, type,(pageNum - 1) * pageSize, pageSize);
    }

    @Override
    public int total2(int id,int type) {
        return pmsProductAttributeCategoryMapper.total2(id,type);
    }

    @Override
    public int add_attribute(PmsAttributeDto pmsAttributeDto) {
        return pmsProductAttributeCategoryMapper.add_attribute(pmsAttributeDto);
    }

    @Override
    public int update_attribute(PmsProductAttributeCategory pmsProductAttributeCategory) {
        return pmsProductAttributeCategoryMapper.update_attribute(pmsProductAttributeCategory);
    }

    @Override
    public int update_attribute2(PmsAttributeDto pmsAttributeDto) {
        return pmsProductAttributeCategoryMapper.update_attribute2(pmsAttributeDto);
    }

    @Override
    public PmsAttributeDto select_attributeById(int id) {
        return pmsProductAttributeCategoryMapper.select_attributeById(id);
    }

    @Override
    public int delete_attribute(int id) {
        return pmsProductAttributeCategoryMapper.delete_attribute(id);
    }

    @Override
    public Integer select_attribute_type(int id) {
        return pmsProductAttributeCategoryMapper.select_attribute_type(id);
    }

    @Override
    public Integer select_attribute_productAttributeCategoryId(int id) {
        return pmsProductAttributeCategoryMapper.select_attribute_productAttributeCategoryId(id);
    }

    @Override
    public Integer update_attribute_count(int productAttributeCategoryId) {
        return pmsProductAttributeCategoryMapper.update_attribute_count(productAttributeCategoryId);
    }

    @Override
    public Integer update_attribute_param_count(int productAttributeCategoryId) {
        return pmsProductAttributeCategoryMapper.update_attribute_param_count(productAttributeCategoryId);
    }
}
